package org.aliwo.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * .
 *
 * @author Xu Yayuan
 * @date 2022/4/12
 */
public class ThreadPoolDemoMain {
    public static void main(String[] args) {
        // 创建固定数量的线程池
        ExecutorService executorService = Executors.newFixedThreadPool(3);
        for (int i = 0; i < 10; i++) {
            executorService.execute(new ThreadPoolDemo());
        }
        System.out.println("主线程名称: " + Thread.currentThread().getName());
        // 关闭线程池
        executorService.shutdown();
    }
}
